/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package visao;

/**
 *
 * @author hanna
 */
public class JanelaTecladoNumerico extends javax.swing.JFrame {
    public String IDcartao;
    public String debito;

    /**
     * Creates new form JanelaTecladoNumerico
     */
    public JanelaTecladoNumerico() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton12 = new javax.swing.JButton();
        visor = new javax.swing.JPasswordField();
        dois = new javax.swing.JButton();
        tres = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        zero = new javax.swing.JButton();
        quatro = new javax.swing.JButton();
        cinco = new javax.swing.JButton();
        seis = new javax.swing.JButton();
        sete = new javax.swing.JButton();
        oito = new javax.swing.JButton();
        nove = new javax.swing.JButton();
        um = new javax.swing.JButton();
        Enter = new javax.swing.JButton();
        Sair = new javax.swing.JButton();

        jButton12.setText("jButton12");

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        visor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                visorActionPerformed(evt);
            }
        });
        getContentPane().add(visor, new org.netbeans.lib.awtextra.AbsoluteConstraints(36, 20, 228, 30));

        dois.setText("2");
        dois.setBorder(new javax.swing.border.MatteBorder(null));
        dois.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                doisActionPerformed(evt);
            }
        });
        getContentPane().add(dois, new org.netbeans.lib.awtextra.AbsoluteConstraints(87, 143, 45, 33));

        tres.setText("3");
        tres.setBorder(new javax.swing.border.MatteBorder(null));
        tres.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tresActionPerformed(evt);
            }
        });
        getContentPane().add(tres, new org.netbeans.lib.awtextra.AbsoluteConstraints(138, 143, 45, 33));

        jButton4.setText("Limpar");
        jButton4.setBorder(new javax.swing.border.MatteBorder(null));
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(87, 182, 96, 33));

        zero.setText("0");
        zero.setBorder(new javax.swing.border.MatteBorder(null));
        zero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                zeroActionPerformed(evt);
            }
        });
        getContentPane().add(zero, new org.netbeans.lib.awtextra.AbsoluteConstraints(36, 182, 45, 33));

        quatro.setText("4");
        quatro.setBorder(new javax.swing.border.MatteBorder(null));
        quatro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                quatroActionPerformed(evt);
            }
        });
        getContentPane().add(quatro, new org.netbeans.lib.awtextra.AbsoluteConstraints(36, 104, 45, 33));

        cinco.setText("5");
        cinco.setBorder(new javax.swing.border.MatteBorder(null));
        cinco.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cincoActionPerformed(evt);
            }
        });
        getContentPane().add(cinco, new org.netbeans.lib.awtextra.AbsoluteConstraints(87, 104, 45, 33));

        seis.setText("6");
        seis.setBorder(new javax.swing.border.MatteBorder(null));
        seis.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                seisActionPerformed(evt);
            }
        });
        getContentPane().add(seis, new org.netbeans.lib.awtextra.AbsoluteConstraints(138, 104, 45, 33));

        sete.setText("7");
        sete.setBorder(new javax.swing.border.MatteBorder(null));
        sete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                seteActionPerformed(evt);
            }
        });
        getContentPane().add(sete, new org.netbeans.lib.awtextra.AbsoluteConstraints(36, 66, 45, 33));

        oito.setText("8");
        oito.setBorder(new javax.swing.border.MatteBorder(null));
        oito.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                oitoActionPerformed(evt);
            }
        });
        getContentPane().add(oito, new org.netbeans.lib.awtextra.AbsoluteConstraints(87, 66, 45, 33));

        nove.setText("9");
        nove.setBorder(new javax.swing.border.MatteBorder(null));
        nove.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                noveActionPerformed(evt);
            }
        });
        getContentPane().add(nove, new org.netbeans.lib.awtextra.AbsoluteConstraints(138, 66, 45, 33));

        um.setText("1");
        um.setBorder(new javax.swing.border.MatteBorder(null));
        um.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                umActionPerformed(evt);
            }
        });
        getContentPane().add(um, new org.netbeans.lib.awtextra.AbsoluteConstraints(36, 143, 45, 33));

        Enter.setText("Enter");
        Enter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EnterActionPerformed(evt);
            }
        });
        getContentPane().add(Enter, new org.netbeans.lib.awtextra.AbsoluteConstraints(193, 66, 71, 71));

        Sair.setText("Sair");
        getContentPane().add(Sair, new org.netbeans.lib.awtextra.AbsoluteConstraints(193, 143, 71, 71));

        setSize(new java.awt.Dimension(318, 278));
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void seisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_seisActionPerformed
        // TODO add your handling code here:
        preecher_visor("6"); // preenche com o valor 6 
    }//GEN-LAST:event_seisActionPerformed

    private void oitoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_oitoActionPerformed
        // TODO add your handling code here:
        preecher_visor("8"); // preenche com o valor 8 
    }//GEN-LAST:event_oitoActionPerformed

    private void umActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_umActionPerformed
        // TODO add your handling code here:
        preecher_visor("1"); // preenche com o valor 1 
    }//GEN-LAST:event_umActionPerformed

    private void zeroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zeroActionPerformed
        // 
        preecher_visor("0"); // preenche com o valor 0 
        
        
    }//GEN-LAST:event_zeroActionPerformed

    private void doisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_doisActionPerformed
        // TODO add your handling code here:
        preecher_visor("2"); // preenche com o valor 2 
    }//GEN-LAST:event_doisActionPerformed

    private void tresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tresActionPerformed
        // TODO add your handling code here:
        preecher_visor("3"); // preenche com o valor 3 
    }//GEN-LAST:event_tresActionPerformed

    private void quatroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quatroActionPerformed
        // TODO add your handling code here:
        preecher_visor("4"); // preenche com o valor 4 
    }//GEN-LAST:event_quatroActionPerformed

    private void cincoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cincoActionPerformed
        // TODO add your handling code here:
        preecher_visor("5"); // preenche com o valor 5 
    }//GEN-LAST:event_cincoActionPerformed

    private void seteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_seteActionPerformed
        // TODO add your handling code here:
        preecher_visor("7"); // preenche com o valor 7 
    }//GEN-LAST:event_seteActionPerformed

    private void noveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noveActionPerformed
        // TODO add your handling code here:
        preecher_visor("9"); // preenche com o valor 9 
    }//GEN-LAST:event_noveActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        // TODO add your handling code here:
        visor.setText("");
    }//GEN-LAST:event_jButton4ActionPerformed

    private void visorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_visorActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_visorActionPerformed

    private void EnterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EnterActionPerformed
        // TODO add your handling code here:
        String valor = visor.getText();
        //System.out.println(valor);
        JanelaDebito frame = new JanelaDebito();
        frame.NumCartaoUsuario.setText(IDcartao);
        frame.Valor.setText(debito);
        frame.SenhaCartao.setText(valor);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_EnterActionPerformed
    private void preecher_visor(String valor){ 
      String valor_atual = visor.getText(); // pega o texto atual do visor 
      visor.setText(valor_atual + valor); // adiciona o texto ao valor atual 
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(JanelaTecladoNumerico.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(JanelaTecladoNumerico.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(JanelaTecladoNumerico.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(JanelaTecladoNumerico.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new JanelaTecladoNumerico().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Enter;
    private javax.swing.JButton Sair;
    private javax.swing.JButton cinco;
    private javax.swing.JButton dois;
    private javax.swing.JButton jButton12;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton nove;
    private javax.swing.JButton oito;
    private javax.swing.JButton quatro;
    private javax.swing.JButton seis;
    private javax.swing.JButton sete;
    private javax.swing.JButton tres;
    private javax.swing.JButton um;
    private javax.swing.JPasswordField visor;
    private javax.swing.JButton zero;
    // End of variables declaration//GEN-END:variables
}
